package com.heima.comment.Controller.v1;

import com.heima.comment.service.CommentRepayService;
import com.heima.model.comment.dtos.CommentRepayDto;
import com.heima.model.comment.dtos.CommentRepayLikeDto;
import com.heima.model.comment.dtos.CommentRepaySaveDto;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api("评论回复api")
@RestController
@RequestMapping("/api/v1/comment_repay")
public class CommentRepayController {

    @Autowired
    private CommentRepayService commentRepayService;

    @ApiOperation("查看更多回复内容")
    @PostMapping("/load")
    public ResponseResult loadCommentRepay(@RequestBody @Validated CommentRepayDto dto) {
        return commentRepayService.loadCommentRepay(dto);
    }

    @ApiOperation("保存回复")
    @PostMapping("/save")
    public ResponseResult saveCommentRepay(@RequestBody @Validated CommentRepaySaveDto dto) {
        return commentRepayService.saveCommentRepay(dto);
    }

    @ApiOperation("点赞回复的评论")
    @PostMapping("/like")
    public ResponseResult saveCommentRepayLike(@RequestBody @Validated CommentRepayLikeDto dto) {
        return commentRepayService.saveCommentRepayLike(dto);
    }

}